package web.dao.Impl;

import web.bean.User;
import web.dao.UserDao;
import web.utils.DBUtil;

import java.util.List;

public class UserDaoImpl implements UserDao {
    @Override
    public User findUserByUserNameAndPassword(String username, String password) {
        return DBUtil.findOneByWhere(User.class,"username=? and password=?",username,password);
    }

    @Override
    public User findUserById(Integer id) {
        return DBUtil.findOneByWhere(User.class,"id=?",id);
    }

    @Override
    public int updateInfo(User user) {
        return DBUtil.update(user,"id=?",user.getId());
    }

    @Override
    public List<User> selectUser() {
        return DBUtil.findAll(User.class);
    }
}
